﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using GeneralDFS.BusinessLogical.Nodes;

namespace GeneralDFS.BusinessLogical.NodeOperate
{
    public class DeleteBlock:INodeOperate
    {
        private string _fileName;
        private DataNode dataNode;
        public void Operate()
        {
            File.Delete(Path.Combine(dataNode.GetNodeConfig().DataNodeDirectory, _fileName));
            File.Delete(Path.Combine(dataNode.GetNodeConfig().DataNodeDirectory, _fileName + ".meta"));
        }

        public void ProcessParam(string[] param)
        {
            if(param==null||param.Length==0) return;
            _fileName = param[0];
        }

        public void ChangeDataNode(DataNode node)
        {
            dataNode = node;
        }
    }
}